package net.monkeybros.sbus.model;

import com.neurospeech.wsclient.*;
import org.w3c.dom.*;

public class InfoLinea extends WSObject
{
	
	private String _label;
	public String getlabel(){
		return _label;
	}
	public void setlabel(String value){
		_label = value;
	}
	private String _nombre;
	public String getnombre(){
		return _nombre;
	}
	public void setnombre(String value){
		_nombre = value;
	}
	private java.util.Vector<InfoSublinea> _sublineas = new java.util.Vector<InfoSublinea>();
	public java.util.Vector<InfoSublinea> getsublineas(){
		return _sublineas;
	}
	public void setsublineas(java.util.Vector<InfoSublinea> value){
		_sublineas = value;
	}
	
	public static InfoLinea loadFrom(Element root) throws Exception
	{
		if(root==null){
			return null;
		}
		InfoLinea result = new InfoLinea();
		result.load(root);
		return result;
	}
	
	
	protected void load(Element root) throws Exception
	{
		Element child = null;
		NodeList list;
		int i;
		this.setlabel(WSHelper.getString(root,"label",false));
		this.setnombre(WSHelper.getString(root,"nombre",false));
		child = WSHelper.getElement(root, "sublineas");
		if(child != null)
		{
			list = child.getChildNodes();
			for(i=0;i<list.getLength();i++)
			{
				Element nc = (Element)list.item(i);
				_sublineas.addElement(InfoSublinea.loadFrom(nc));
			}
		}
	}
	
	
	
	public Element toXMLElement(Element root)
	{
		Element e = root.getOwnerDocument().createElement("InfoLinea");
		fillXML(e);
		return e;
	}
	
	public void fillXML(Element e)
	{
		if(_label!=null)
			WSHelper.addChild(e,"label",String.valueOf(_label),false);
		if(_nombre!=null)
			WSHelper.addChild(e,"nombre",String.valueOf(_nombre),false);
		if(_sublineas!=null)
			WSHelper.addChildArray(e,"sublineas",null,_sublineas);
	}
	
}
